package org.example.controller;


import org.example.pojo.SysUser;
import org.example.service.SysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
public class SysUserController {

    @Autowired
    private SysUserService sysUserService;

    @PostMapping("/user/add")
    public boolean addUser(@RequestBody SysUser sysUser){
        return sysUserService.addSysUser(sysUser);
    }

    @GetMapping("/user/get/{id}")
    public SysUser getUser(@PathVariable Integer id){
        SysUser sysUser = sysUserService.queryById(id);
        return sysUser;
    }

    @GetMapping("/user/list")
    public List<SysUser> queryAll(){
        List<SysUser> sysUsers = sysUserService.queryAll();
        return sysUsers;
    }



}
